package ClientLogic;

import java.sql.SQLException;

import stuff.Worker;
import ClientDataBase.ClientDBUtils;
import ClientDataBase.ClientIDBUtils;

public class Login implements ILogin {
	private ClientIDBUtils handler;
	
	public Login(){
		handler = new ClientDBUtils();
	}
	
	public boolean verifySaler(String id, String password){
		Worker w = null;
		try {
			w = handler.getWorkerInfo(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		if(w!=null){
			if(w.getPassword().equals(password)&&w.getPosition()==1)
				return true;
		}
		return false;
	}
	
	public boolean verifySubShopManager(String id, String password){
		Worker w = null;
		try {
			w = handler.getWorkerInfo(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		if(w!=null){
			if(w.getPassword().equals(password)&&w.getPosition()==0)
				return true;
		}
		return false;
	}
}
